#include <Volume.h>

const unsigned int tspToBase = 1;
const unsigned int tbspToBase = 3 * tspToBase;
const unsigned int ozToBase = 2 * tbspToBase;

const Unit tsp(tspToBase, "tsp");
const Unit tbsp(tbspToBase, "tbsp");
const Unit oz(ozToBase, "oz");

const Unit volumeUnitArray[] = {tsp, tbsp, oz};

Volume::Volume(const unsigned int amount, const Unit unit) :
		Measure(amount, unit)
{
}

bool Volume::operator == (const Volume& volume) const
{
	return (this->toBase() == volume.toBase());
}

Volume Volume::operator + (const Volume& volume) const
{
	return Volume(this->toBase() + volume.toBase(), tsp);
}

void Volume::formatPrint()
{
	Measure::formatPrint(&(volumeUnitArray[0]), sizeof(volumeUnitArray)/sizeof(Unit));
}

